class node {
public:
    string s;
    int c;
    node(string s, int c) {
        this->s = s;
        this->c = c;
    }
    bool operator<(const node& i) const{
        return c > i.c || (c == i.c && s < i.s);
    }
};
class SORTracker {
    set<node> st;
    int cnt = -1;
    set<node>::iterator p = st.begin();
public:
    SORTracker() {
        st.clear();
        cnt = -1;
        p = st.begin();
    }
    
    void add(string name, int score) {
        st.insert(node(name,score));
        if (cnt == -1)
            return;
        if (score > (p->c)) {
            p--;
            return;
        }
        if (score == (p->c) && name < (p->s)) {
            p--;
            return;
        }
    }
    
    string get() {
        cnt ++ ;
        if (cnt == 0) {
            p = st.begin();
            return p->s;
        }
        p ++ ;
        return p->s;
    }
};

/**
 * Your SORTracker object will be instantiated and called as such:
 * SORTracker* obj = new SORTracker();
 * obj->add(name,score);
 * string param_2 = obj->get();
 */
